package com.zjw.hyphenateui.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.havi.bean.HyChatUser;
import com.example.havi.interfaces.LoginCallBack;
import com.example.havi.util.ChatSPUtil;
import com.zjw.hyphenateui.MainApplication;
import com.zjw.hyphenateui.R;
import com.zjw.hyphenateui.bean.UserBean;
import com.zjw.hyphenateui.helper.UserHelper;
import com.zjw.hyphenateui.util.ToastUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class LoginActivity extends AppCompatActivity {

    @BindView(R.id.editText)
    EditText editText;
    @BindView(R.id.textView2)
    TextView textView2;
    @BindView(R.id.editText2)
    EditText editText2;
    @BindView(R.id.button)
    Button button;
    @BindView(R.id.progress_fl)
    RelativeLayout progressFl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.button)
    public void onViewClicked() {
        final String user = editText.getText().toString();
        if (user.isEmpty()) {
            ToastUtil.showToast(this, "请输入与用户名");
            return;
        }
        final String pwd = editText2.getText().toString();
        if (pwd.isEmpty()) {
            ToastUtil.showToast(this, "请输入密码");
            return;
        }
        progressFl.setVisibility(View.VISIBLE);

        Intent intent = new Intent(this,MainActivity.class);
        intent.putExtra("username",user);
        intent.putExtra("password",pwd);
        startActivity(intent);

    }




}
